import cv2
cap = cv2.VideoCapture(0)
cap.set(3, 400)
cap.set(4, 600)

while True:
    _,frame = cap.read()
    cv2.imshow('name',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break